<script type="text/javascript">
Ext.namespace('catalog.catalog.averageDisciplines');

catalog.catalog.averageDisciplines.SearchPanel = Ext.extend(catalog.ComplexEditorGrid, {
displayName:'Disciplina',
firstSem:'Medie sem I',
secondSem:'Medie sem II',
finalAvg:'Medie finala',

initComponent:function() {
var config = {
compSet:[{url:0,reader:0,columns:0,bbarAction:0}],
searchFields :[[
                this.displayName, {xtype:'textfield', name:'averageDTO.lastName', width:120}
                ]],
                urls: ['averageByDisciplines.action'],
                readers : [[
                          {name: 'id'},
                          {name: 'displayName'},
                          {name: 'avgSem1'},
                          {name: 'avgSem2'},
                          {name: 'totalAvg'}
                ]],
columnsArray: [[
                     {header: this.displayName, width: 100, sortable: true, dataIndex: 'displayName'},
                     {header: this.firstSem, width: 70, sortable: true, dataIndex: 'avgSem1'},
                     {header: this.secondSem, width: 70, sortable: true, dataIndex: 'avgSem2'},
                     {header: this.finalAvg, width: 70, sortable: true, dataIndex: 'totalAvg'}

                ]],
                bbarActions:[[{
                            text:'Medie Generala',
                            iconCls :'info-icon',
                            scope:this,
                            handler:this.medieGenerala
                            }    ]],
                    tbarActions : [{
                                text:"Exporta",
                                iconCls :'add-icon',
                                scope:this,
                                handler : function(){
                                                       document.location = "avgDisciplineExportXLS.action";
                                                    }
                            }],

  autoScroll:true
}; // eo config object

Ext.apply(this, Ext.apply(this.initialConfig, config));
    catalog.catalog.averageDisciplines.SearchPanel.superclass.initComponent.apply(this, arguments);
    },
        medieGenerala :function() {
                      catalog.util.ajaxRequest({
                                                                              url: 'totalAvg.action',
                                                                              success:function(r,o){
                                                                                       showMsg('success', obj.message);

                                                                              },
                                                                              failure:Ext.emptyFn
                                                                          },this);
                        }
});


try {averageDisciplinesLocale();} catch (e) {}

Ext.onReady(function() {
            Ext.QuickTips.init();
            var formPanel = new catalog.catalog.averageDisciplines.SearchPanel();
                formPanel.store.reload();
            if (mainPanel) {
            mainPanel.getActiveTab().add(formPanel);
            mainPanel.getActiveTab().doLayout();
            } else {
            var vp = new Ext.Viewport({
            layout:'fit',
            items:[formPanel]
            });
            }
            });
</script>